package com.kidedu.action;

import java.util.Date;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.kidedu.entity.KClass;
import com.kidedu.entity.TbClass;
import com.kidedu.service.IKClassService;
import com.kidedu.util.BaseAction;
import com.kidedu.util.Pagination;
import com.kidedu.util.SpringContextUtil;

public class KClassAction extends BaseAction {
    
	private static final long serialVersionUID = 1L;
	
	private int pageNo;
	
	private int PageSize;
	
	private String keyWords;
	
	private KClass tbClass;
	
	private int count;
	
	private String classId;
	
	private IKClassService iKClassService = (IKClassService) SpringContextUtil.getBean("iKClassService");
	
	private List<KClass> kClassList;
	
	private Pagination<KClass> kClassPaginationList;
	
	private String[] files;
	

	public String addKClass() {
		count = iKClassService.addKClass(tbClass);
		return "JSON";
	}
	

	public String deleteKClass() {
		count = iKClassService.deleteKClass(classId);
		return "JSON";
	}
	

	public String updateKClass() {
		tbClass.setCreatetime(new Date());
		count = iKClassService.updateKClass(tbClass);
		return "JSON";
	}
	
	
	public String selectKClassList() {
		kClassList = iKClassService.selectKClassList();
		return "JSON";
	}
	
	public String selectKClassListFY() {
		kClassPaginationList = iKClassService.selectKClassList(PageSize, pageNo);
		return "JSON";
	}
	public String selectKClassListBypageNo() {
		/*System.out.println(keyWords);*/
		kClassPaginationList = iKClassService.selectKClassList(pageNo, keyWords);
		return "JSON";
	}
	public String selectKClassListpass(){
		kClassPaginationList=iKClassService.selectKClassListPass(PageSize, pageNo);
		return "JSON";
	}
	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public String getKeyWords() {
		return keyWords;
	}

	public void setKeyWords(String keyWords) {
		this.keyWords = keyWords;
	}

	public KClass getTbClass() {
		return tbClass;
	}

	public void setTbClass(KClass tbClass) {
		this.tbClass = tbClass;
	}

	public List<KClass> getkClassList() {
		return kClassList;
	}

	public void setkClassList(List<KClass> kClassList) {
		this.kClassList = kClassList;
	}

	public Pagination<KClass> getkClassPaginationList() {
		return kClassPaginationList;
	}

	public void setkClassPaginationList(Pagination<KClass> kClassPaginationList) {
		this.kClassPaginationList = kClassPaginationList;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public String getClassId() {
		return classId;
	}

	public void setClassId(String classId) {
		this.classId = classId;
	}

	public String[] getFiles() {
		return files;
	}

	public void setFiles(String[] files) {
		this.files = files;
	}


	public int getPageSize() {
		return PageSize;
	}


	public void setPageSize(int pageSize) {
		PageSize = pageSize;
	}
	
}
